package gps.methods.dfs_inform;

import gps.Node;
import gps.methods.BaseMethod;
import gps.methods.BaseNode;
import gps_api.Problem;
import gps_api.Rule;
import gps_api.State;

import java.util.Collections;

public class DfsInformMethod extends BaseMethod{
	private Problem problem;
	
	public DfsInformMethod(Problem problem){
		this.problem= problem;
	}
	
	@Override
	public void addChild(State state, Rule rule) {
		Node node= new BaseNode(lastNode, state, rule, 0.0, problem.getHeuristic(state));
		if(!isInOpenedList(node)){
			openedNodes.add(node);
			Collections.sort(openedNodes);
		}
	}

}
